package com.example.loginservice;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.PreparedStatement;

import java.sql.Connection;
import java.sql.ResultSet;

@RestController
public class T2 {
    @RequestMapping("/T2")
    public String ppp(String name ,String password) throws Exception {
        T1 t1 = new T1();
        Connection tianyun = t1.tianyun();
        PreparedStatement preparedStatement = ((java.sql.Connection) tianyun).prepareStatement("select * from ppp where name=? and password = ?");
        preparedStatement.setString(1, name);
        preparedStatement.setString(2, password);
        ResultSet rs = preparedStatement.executeQuery();
        if (rs.next()) {
            return "登陆成功";
        }
        return "登录失败";
    }
}
